{{ content() }}
<div id="dialog" title="Basic dialog" style="display: none;">
</div>
<section id="main">
    <div class="actions" style="margin: 20px auto; width: 600px">
        <select name="action" id="action">
            <option selected="selected">Tác vụ</option>
            <option value="edit">Chỉnh sửa</option>
            <option value="trash">Xóa</option>
        </select>
        <input type="submit" name="" id="actionbtn" class="button action" value="Áp dụng">
        {{form.render('doctype')}}
        <input type="submit" name="" id="" class="button action" value="Lọc">
        <input type="submit" name="" id="add_topic_btn" class="button action" value="Thêm chủ đề">
    </div>
    <div class="add_topic" id="add_topic">
        {{form('id':'adminForm','class':'adminForm')}}
        <h2>Thêm chủ đề</h2>        
        <p><span>Chọn loại tài liệu:</span>
            <span class="add_type_nput">{{form.render('doctype')}}</span>
            <div class="add_type_message">{{form.messages('doctype')}}</div>
        </p>     
        <p><span>Tên chủ đề:</span>
            <span class="add_topic_input">{{form.render('name')}}</span>
            <div class="add_topic_message">{{form.messages('name')}}</div>
        </p>
        <input type="submit" name="" id="doaction" class="button action" value="Thêm">
        <input type="reset" id="cancel_addtopic" name="" class="button action" value="Hủy">
        {{form.render('csrf',['value': security.getToken()])}}
        
        {{endform()}}
    </div>
    <div class="inline">               
        <article class="manage_category module">
            <header>
                <h3 class="tabs_involved">Quản lý chủ đề</h3>                       
            </header>

            <div class="tab_container">
                <div class="tab_content">
                    <table class="tablesorter" cellspacing="0"> 
                        <thead> 
                            <tr> 
                                <th></th> 
                                <th>DocType</th>   
                                <th>Topic</th>         
                                <th>Action</th> 
                            </tr> 
                        </thead> 
                        <tbody> 
                            {% for topic in topics %}
                            <tr> 
                                <td><input class="item" type="checkbox"  data-id="{{topic.id}}" name="checkbox[]"></td>                                
                                <td><select id="type-{{topic.id}}" disabled>
                                        {% for type in types %}
                                        {% if type.id == topic.doctype_id %}
                                        <option value="{{type.id}}" selected>{{type.name}}</option>
                                        {% else %}
                                        <option value="{{type.id}}">{{type.name}}</option>
                                        {% endif %}
                                        {% endfor %}
                                    </select>
                                </td>
                                <td><input type="text" disabled id="category-name-{{topic.id}}" class="category-name" value="{{topic.name}}"/></td>
                                <td><input class="editbtn" id="editbtn-{{topic.id}}" data-id="{{topic.id}}" type="image" src="{{url('css/admin/images/icn_edit.png')}}" title="Edit">
                                    <input class="savebtn" id="savebtn-{{topic.id}}" data-id="{{topic.id}}" type="image" src="{{url('css/admin/images/icn_alert_success.png')}}" title="Save">
                                    <input type="image" class="deletebtn" data-id="{{topic.id}}" src="{{url('css/admin/images/icn_trash.png')}}" title="Trash"></td> 
                            </tr> 
                            {% endfor %}
                        </tbody> 
                    </table>
                </div><!-- end of #tab1 -->
            </div><!-- end of .tab_container -->
        </article><!-- end of content manager article --> 
    </div>
</section>
{{javascript_include('js/admin/topics.js')}}

